package com.itqf.proxy.dynamic_proxy2;

import com.itqf.proxy.dynamic_proxy2.factory.MyCglibProxyFactory;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/11/10
 * @Time: 下午2:58
 */
public class TestCglib {
    public  static  void  main(String[]args){
        //1,创建被代理对象
        GoodsServiceImpl goodsService = new GoodsServiceImpl();
        //2.创建代理对象
        GoodsServiceImpl proxyGoodsService =  MyCglibProxyFactory.createProxy(goodsService);
        //3.代理对象调用方法
        proxyGoodsService.addGoods("小米");
        System.out.println(proxyGoodsService.updateGoods());


        System.out.println("--------------");
        OrderServiceImpl orderService = new OrderServiceImpl();
        OrderServiceImpl proxyOrderService =  MyCglibProxyFactory.createProxy(orderService);
        proxyOrderService.addOrder();
        proxyOrderService.updateOrder();




    }
}
